@extends("admin.frame_layout")
<?php $top_selected = "信息管理";$page_menu = "文章列表" ?>
@section('content')
    <div class="rightinfo">
        <div class="tools">
            <form method="get" id="sform" action="{{route('admin.news')}}">
                <ul class="toolbar">
                    <li>
                        <a href="{{route('admin.news.edit',['id'=>0])}}">
                            <span><img src="{{asset('admin/imgs/t01.png')}}"/></span>发布新文章
                        </a>
                    </li>
                    <li>
                        <input type="text" name="start" placeholder="开始时间"
                               onClick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm:ss'})">
                    </li>
                    <li>
                        <input type="text" name="end" placeholder="结束时间"
                               onClick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm:ss'})">
                    </li>
                    <li>
                        <select name="classify">
                            <option value="">按分类筛选</option>
                            @foreach($classifies as $item)
                                <option value="{{$item->id}}">{{$item->title}}</option>
                            @endforeach
                        </select>
                    </li>
                    <li>
                        <input id="search_str" name="search_str" type="text" placeholder="搜索条件">
                    </li>
                    <li>
                        <select name="sort_type">
                            <option value="1" selected>降序 ↓</option>
                            <option value="2">升序 ↑</option>
                        </select>
                    </li>
                    <li>
                        <a href="javascript:void(0)" onclick="$('#sform').submit()">
                            <span><img src="{{asset('admin/imgs/ico06.png')}}" width="20px"
                                       height="20px"/></span>搜索
                        </a>
                    </li>
                </ul>
            </form>
        </div>

        <table class="tablelist">
            <thead>
            <tr>
                <th width="70px">操作</th>
                <th width="100px">编号<i class="sort"><img src="{{asset('admin/imgs/px.gif')}}"/></i></th>
                <th style="text-align: left;">文章标题</th>
                <th style="text-align: left;">文章分类</th>
                <th width="150px">更新时间</th>
            </tr>
            </thead>
            <tbody>
            @foreach($news as $item)
                <tr>
                    <td class="act" bind="#{{$item->id}}">
                        <img src="{{asset('admin/imgs/t05.png')}}"/>菜单
                        <ul id="{{$item->id}}">
                            <li>
                                <a href="{{route('admin.news.edit',['id'=>$item->id])}}">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>编辑文章
                                </a>
                            </li>
                            <li onclick="openOkDlg('{{route('admin.news.del',['id'=>$item->id])}}')">
                                <img src="{{asset('admin/imgs/d02.png')}}"/>删除
                            </li>
                        </ul>
                    </td>
                    <td>{{$item->id}}</td>
                    <td class="text-left">{{$item->title}}</td>
                    <td class="text-left">{{$item->classify->title or "无"}}</td>
                    <td>{{date("Y-m-d H:i:s",$item->time)}}</td>
                </tr>
            @endforeach
            </tbody>
        </table>
        @include('admin.coms.fenye')
    </div>

    @include('admin.coms.dialog')
@endsection
@section('footer')
    <script src="{{asset('admin/js/laydate/laydate.js')}}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            laydate.skin("dahong"); //大红色日期选择皮肤
            //初始化表格操作菜单
            $('.tablelist tbody tr:odd').addClass('odd');
            $(".tablelist .act").hover(function () {
                $($(this).attr("bind")).show();
            }, function () {
                $($(this).attr("bind")).hide();
            });
        });
    </script>
@endsection

